<?php
include '../c/config.php';
if (isset($_POST['hua'])){
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
	
	$openid=@$_SESSION['openid'];
	$hua=addslashes(trim($_POST['hua']));
	$avatar='';
	$query=$mysqli->query("SELECT headimg FROM `users` where openid='".$openid."' limit 0,1 ");
	if($query->num_rows>0){
		$userInfo=$query->fetch_array();
		$avatar=$userInfo['headimg'];
	}
	$sql="insert into hua(openid,avatar,shuo,createtime) values('".$openid."','".$avatar."','".$hua."','".date("Y-m-d H:i:s")."')  ";
	$mysqli->query($sql);
	echo json_encode(array('status'=>'ok'));
}

?>